package com.guoranhao.web.filter;//package com.llb.cloudyoung.web.filter;
//
//import org.springframework.stereotype.Component;
//import org.springframework.web.cors.CorsConfiguration;
//import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
//import org.springframework.web.filter.CorsFilter;
//
///**
// *
// * Description: 解决跨域
// * Copyright (c) Department of Research and Development/Beijing
// * All Rights Reserved.
// * @version 1.0  2016年10月20日 下午2:00:10  by 钱丽颖 （qianliying@cloud-young.com/）创建
// */
//@Component
//public class CrossDomainFilter extends CorsFilter {
//
//    public CrossDomainFilter() {
//        super(configurationSource());
//    }
//    private static UrlBasedCorsConfigurationSource configurationSource() {
//        CorsConfiguration config = new CorsConfiguration();
//        config.setAllowCredentials(true);
//        config.addAllowedOrigin("*");
//        config.addAllowedHeader("token");
//        config.addAllowedHeader("x-requested-with");
//        config.addAllowedHeader("Content-Type");
//        config.addAllowedHeader("platformNo");
//        config.addAllowedHeader("deviceType");
//        config.addAllowedHeader("appClient");
//        config.addAllowedHeader("accessChannel");
//        config.addAllowedHeader("deviceModel");
//        config.addAllowedHeader("channel");
//        config.addAllowedHeader("version");
//        config.addAllowedHeader("imsi");
//        config.addAllowedHeader("imei");
//        config.addAllowedHeader("ip");
//        config.addAllowedHeader("cityName");
//
//        config.addAllowedMethod("GET");
//        config.addAllowedMethod("POST");
//        config.addAllowedMethod("OPTIONS");
//        config.addAllowedMethod("HEAD");
//        config.addAllowedMethod("DELETE");
//        config.addAllowedMethod("PUT");
//        config.setMaxAge(3600L);
//        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
//        source.registerCorsConfiguration("/**", config);
//        return source;
//    }
//
//}
